using System.Globalization;
using System.Xml.Serialization;

namespace HengTong.Kingdee.WSWMSImportBillFacadeSrvProxyService
{
    /// <summary>
    /// EAS 公司组织数据信息
    /// </summary>
    [XmlRoot("DataInfo")]
    public class EasCompanyDataInfo
    {
        [XmlElement("DataHead")]
        public EasCompanyDataHead DataHead { get; set; }
    }

    /// <summary>
    /// EAS 公司组织数据头
    /// </summary>
    public class EasCompanyDataHead
    {
        /// <summary>
        /// 税务地址
        /// </summary>
        [XmlElement("taxAddress")]
        public string TaxAddress { get; set; }

        /// <summary>
        /// 最后更新用户
        /// </summary>
        [XmlElement("lastUpdateUser")]
        public string LastUpdateUser { get; set; }

        /// <summary>
        /// 是否管理组织
        /// </summary>
        [XmlElement("isAdminOrgUnit")]
        public int IsAdminOrgUnit { get; set; }

        /// <summary>
        /// 是否运输组织
        /// </summary>
        [XmlElement("isTransportOrgUnit")]
        public int IsTransportOrgUnit { get; set; }

        /// <summary>
        /// 终止日期（原始字符串）
        /// </summary>
        [XmlElement("endupDate")]
        public string EndupDateString { get; set; }

        /// <summary>
        /// 终止日期（DateTime 类型）
        /// </summary>
        [XmlIgnore]
        public DateTime? EndupDate
        {
            get
            {
                if (string.IsNullOrWhiteSpace(EndupDateString))
                    return null;
                if (DateTime.TryParseExact(EndupDateString, "yyyy-MM-dd",
                    CultureInfo.InvariantCulture, DateTimeStyles.None, out var result))
                    return result;
                return null;
            }
        }

        /// <summary>
        /// 主组织
        /// </summary>
        [XmlElement("mainOrg")]
        public string MainOrg { get; set; }

        /// <summary>
        /// 注册资本
        /// </summary>
        [XmlElement("registeredCapital")]
        public string RegisteredCapital { get; set; }

        /// <summary>
        /// 报告转换模式
        /// </summary>
        [XmlElement("reportConvertMode")]
        public int ReportConvertMode { get; set; }

        /// <summary>
        /// 失效日期（原始字符串）
        /// </summary>
        [XmlElement("invalidDate")]
        public string InvalidDateString { get; set; }

        /// <summary>
        /// 失效日期（DateTime 类型）
        /// </summary>
        [XmlIgnore]
        public DateTime? InvalidDate
        {
            get
            {
                if (string.IsNullOrWhiteSpace(InvalidDateString))
                    return null;
                if (DateTime.TryParseExact(InvalidDateString, "yyyy-MM-dd",
                    CultureInfo.InvariantCulture, DateTimeStyles.None, out var result))
                    return result;
                return null;
            }
        }

        /// <summary>
        /// 报告汇率表
        /// </summary>
        [XmlElement("reportExchangeTable")]
        public string ReportExchangeTable { get; set; }

        /// <summary>
        /// 层级
        /// </summary>
        [XmlElement("level")]
        public int Level { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        [XmlElement("description")]
        public string Description { get; set; }

        /// <summary>
        /// 是否封存
        /// </summary>
        [XmlElement("isSealUp")]
        public int IsSealUp { get; set; }

        /// <summary>
        /// 是否叶子节点
        /// </summary>
        [XmlElement("isLeaf")]
        public int IsLeaf { get; set; }

        /// <summary>
        /// 会计方案
        /// </summary>
        [XmlElement("accountScheme")]
        public string AccountScheme { get; set; }

        /// <summary>
        /// 银行
        /// </summary>
        [XmlElement("bank")]
        public string Bank { get; set; }

        /// <summary>
        /// 是否人力资源组织
        /// </summary>
        [XmlElement("isHROrgUnit")]
        public int IsHROrgUnit { get; set; }

        /// <summary>
        /// 是否公司组织
        /// </summary>
        [XmlElement("isCompanyOrgUnit")]
        public int IsCompanyOrgUnit { get; set; }

        /// <summary>
        /// 是否发送
        /// </summary>
        [XmlElement("isSend")]
        public int IsSend { get; set; }

        /// <summary>
        /// 行业
        /// </summary>
        [XmlElement("industry")]
        public string Industry { get; set; }

        /// <summary>
        /// 是否境内
        /// </summary>
        [XmlElement("isChurchyard")]
        public int IsChurchyard { get; set; }

        /// <summary>
        /// 是否联盟
        /// </summary>
        [XmlElement("isUnion")]
        public int IsUnion { get; set; }

        /// <summary>
        /// 简称
        /// </summary>
        [XmlElement("simpleName")]
        public string SimpleName { get; set; }

        /// <summary>
        /// 发送消息
        /// </summary>
        [XmlElement("sendMsg")]
        public string SendMsg { get; set; }

        /// <summary>
        /// 是否利润组织
        /// </summary>
        [XmlElement("isProfitOrgUnit")]
        public int IsProfitOrgUnit { get; set; }

        /// <summary>
        /// 父组织
        /// </summary>
        [XmlElement("parent")]
        public string Parent { get; set; }

        /// <summary>
        /// 发票号码
        /// </summary>
        [XmlElement("invoiceNumber")]
        public string InvoiceNumber { get; set; }

        /// <summary>
        /// 编号
        /// </summary>
        [XmlElement("number")]
        public string Number { get; set; }

        /// <summary>
        /// 代码
        /// </summary>
        [XmlElement("code")]
        public string Code { get; set; }

        /// <summary>
        /// 调整汇率表
        /// </summary>
        [XmlElement("adjustExchangeTable")]
        public string AdjustExchangeTable { get; set; }

        /// <summary>
        /// 报告币别
        /// </summary>
        [XmlElement("reportCurrency")]
        public string ReportCurrency { get; set; }

        /// <summary>
        /// 是否销售组织
        /// </summary>
        [XmlElement("isSaleOrgUnit")]
        public int IsSaleOrgUnit { get; set; }

        /// <summary>
        /// 发送次数
        /// </summary>
        [XmlElement("sendCount")]
        public int SendCount { get; set; }

        /// <summary>
        /// 是否辅助组织
        /// </summary>
        [XmlElement("isAssistantOrg")]
        public int IsAssistantOrg { get; set; }

        /// <summary>
        /// 是否仓储组织
        /// </summary>
        [XmlElement("isStorageOrgUnit")]
        public int IsStorageOrgUnit { get; set; }

        /// <summary>
        /// 版本号
        /// </summary>
        [XmlElement("versionNumber")]
        public string VersionNumber { get; set; }

        /// <summary>
        /// 地区
        /// </summary>
        [XmlElement("region")]
        public string Region { get; set; }

        /// <summary>
        /// 基础汇率表
        /// </summary>
        [XmlElement("baseExchangeTable")]
        public string BaseExchangeTable { get; set; }

        /// <summary>
        /// 账户银行
        /// </summary>
        [XmlElement("accountBank")]
        public string AccountBank { get; set; }

        /// <summary>
        /// 是否采购组织
        /// </summary>
        [XmlElement("isPurchaseOrgUnit")]
        public int IsPurchaseOrgUnit { get; set; }

        /// <summary>
        /// 创建时间（原始字符串）
        /// </summary>
        [XmlElement("createTime")]
        public string CreateTimeString { get; set; }

        /// <summary>
        /// 创建时间（DateTime 类型）
        /// </summary>
        [XmlIgnore]
        public DateTime? CreateTime
        {
            get
            {
                if (string.IsNullOrWhiteSpace(CreateTimeString))
                    return null;
                if (DateTime.TryParseExact(CreateTimeString, "yyyy-MM-dd HH:mm:ss",
                    CultureInfo.InvariantCulture, DateTimeStyles.None, out var result))
                    return result;
                return null;
            }
        }

        /// <summary>
        /// 是否分组
        /// </summary>
        [XmlElement("isGrouping")]
        public int IsGrouping { get; set; }

        /// <summary>
        /// 区域
        /// </summary>
        [XmlElement("territory")]
        public string Territory { get; set; }

        /// <summary>
        /// 是否冻结
        /// </summary>
        [XmlElement("isFreeze")]
        public int IsFreeze { get; set; }

        /// <summary>
        /// 最后更新时间（原始字符串）
        /// </summary>
        [XmlElement("lastUpdateTime")]
        public string LastUpdateTimeString { get; set; }

        /// <summary>
        /// 最后更新时间（DateTime 类型）
        /// </summary>
        [XmlIgnore]
        public DateTime? LastUpdateTime
        {
            get
            {
                if (string.IsNullOrWhiteSpace(LastUpdateTimeString))
                    return null;
                if (DateTime.TryParseExact(LastUpdateTimeString, "yyyy-MM-dd HH:mm:ss",
                    CultureInfo.InvariantCulture, DateTimeStyles.None, out var result))
                    return result;
                if (DateTime.TryParseExact(LastUpdateTimeString, "yyyy-MM-dd",
                    CultureInfo.InvariantCulture, DateTimeStyles.None, out result))
                    return result;
                return null;
            }
        }

        /// <summary>
        /// 是否启用
        /// </summary>
        [XmlElement("isStart")]
        public int IsStart { get; set; }

        /// <summary>
        /// 属性封存日期（原始字符串）
        /// </summary>
        [XmlElement("propertySealUpDate")]
        public string PropertySealUpDateString { get; set; }

        /// <summary>
        /// 属性封存日期（DateTime 类型）
        /// </summary>
        [XmlIgnore]
        public DateTime? PropertySealUpDate
        {
            get
            {
                if (string.IsNullOrWhiteSpace(PropertySealUpDateString))
                    return null;
                if (DateTime.TryParseExact(PropertySealUpDateString, "yyyy-MM-dd",
                    CultureInfo.InvariantCulture, DateTimeStyles.None, out var result))
                    return result;
                return null;
            }
        }

        /// <summary>
        /// 发票数量
        /// </summary>
        [XmlElement("invoiceCount")]
        public string InvoiceCount { get; set; }

        /// <summary>
        /// 基础币别
        /// </summary>
        [XmlElement("baseCurrency")]
        public string BaseCurrency { get; set; }

        /// <summary>
        /// 是否质量组织
        /// </summary>
        [XmlElement("isQualityOrgUnit")]
        public int IsQualityOrgUnit { get; set; }

        /// <summary>
        /// 注册代码
        /// </summary>
        [XmlElement("registeredCode")]
        public string RegisteredCode { get; set; }

        /// <summary>
        /// 是否仅联盟
        /// </summary>
        [XmlElement("isOnlyUnion")]
        public int IsOnlyUnion { get; set; }

        /// <summary>
        /// 联系人
        /// </summary>
        [XmlElement("contact")]
        public string Contact { get; set; }

        /// <summary>
        /// 授权代码
        /// </summary>
        [XmlElement("authorizationCode")]
        public string AuthorizationCode { get; set; }

        /// <summary>
        /// 会计期间类型
        /// </summary>
        [XmlElement("accountPeriodType")]
        public string AccountPeriodType { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        [XmlElement("creator")]
        public string Creator { get; set; }

        /// <summary>
        /// 成立日期（原始字符串）
        /// </summary>
        [XmlElement("setupDate")]
        public string SetupDateString { get; set; }

        /// <summary>
        /// 成立日期（DateTime 类型）
        /// </summary>
        [XmlIgnore]
        public DateTime? SetupDate
        {
            get
            {
                if (string.IsNullOrWhiteSpace(SetupDateString))
                    return null;
                if (DateTime.TryParseExact(SetupDateString, "yyyy-MM-dd",
                    CultureInfo.InvariantCulture, DateTimeStyles.None, out var result))
                    return result;
                return null;
            }
        }

        /// <summary>
        /// 法人代表
        /// </summary>
        [XmlElement("juridicalPerson")]
        public string JuridicalPerson { get; set; }

        /// <summary>
        /// 是否集团
        /// </summary>
        [XmlElement("isGroup")]
        public int IsGroup { get; set; }

        /// <summary>
        /// 名称
        /// </summary>
        [XmlElement("name")]
        public string Name { get; set; }

        /// <summary>
        /// 科目表
        /// </summary>
        [XmlElement("accountTable")]
        public string AccountTable { get; set; }

        /// <summary>
        /// 是否业务单元
        /// </summary>
        [XmlElement("isBizUnit")]
        public int IsBizUnit { get; set; }

        /// <summary>
        /// 是否成本组织
        /// </summary>
        [XmlElement("isCostOrgUnit")]
        public int IsCostOrgUnit { get; set; }

        /// <summary>
        /// 税号
        /// </summary>
        [XmlElement("taxNumber")]
        public string TaxNumber { get; set; }

        /// <summary>
        /// 组织类型字符串
        /// </summary>
        [XmlElement("orgTypeStr")]
        public string OrgTypeStr { get; set; }

        /// <summary>
        /// 是否组织封存
        /// </summary>
        [XmlElement("isOUSealUp")]
        public int IsOUSealUp { get; set; }

        /// <summary>
        /// 联系电话
        /// </summary>
        [XmlElement("contactPhone")]
        public string ContactPhone { get; set; }

        /// <summary>
        /// 授权密钥
        /// </summary>
        [XmlElement("authorizationKey")]
        public string AuthorizationKey { get; set; }

        /// <summary>
        /// 控制单元
        /// </summary>
        [XmlElement("CU")]
        public string CU { get; set; }

        /// <summary>
        /// 生效日期（原始字符串）
        /// </summary>
        [XmlElement("effectDate")]
        public string EffectDateString { get; set; }

        /// <summary>
        /// 生效日期（DateTime 类型）
        /// </summary>
        [XmlIgnore]
        public DateTime? EffectDate
        {
            get
            {
                if (string.IsNullOrWhiteSpace(EffectDateString))
                    return null;
                if (DateTime.TryParseExact(EffectDateString, "yyyy-MM-dd",
                    CultureInfo.InvariantCulture, DateTimeStyles.None, out var result))
                    return result;
                return null;
            }
        }

        /// <summary>
        /// 是否控制单元
        /// </summary>
        [XmlElement("isCU")]
        public int IsCU { get; set; }

        /// <summary>
        /// 经济类型
        /// </summary>
        [XmlElement("economicType")]
        public int EconomicType { get; set; }

        /// <summary>
        /// 税务登记名称
        /// </summary>
        [XmlElement("taxRegisterName")]
        public string TaxRegisterName { get; set; }

        /// <summary>
        /// 税务代码
        /// </summary>
        [XmlElement("taxCode")]
        public string TaxCode { get; set; }

        /// <summary>
        /// 地址
        /// </summary>
        [XmlElement("address")]
        public string Address { get; set; }

        /// <summary>
        /// 活动日期（原始字符串）
        /// </summary>
        [XmlElement("activityDate")]
        public string ActivityDateString { get; set; }

        /// <summary>
        /// 活动日期（DateTime 类型）
        /// </summary>
        [XmlIgnore]
        public DateTime? ActivityDate
        {
            get
            {
                if (string.IsNullOrWhiteSpace(ActivityDateString))
                    return null;
                if (DateTime.TryParseExact(ActivityDateString, "yyyy-MM-dd",
                    CultureInfo.InvariantCulture, DateTimeStyles.None, out var result))
                    return result;
                return null;
            }
        }

        /// <summary>
        /// 税务类型
        /// </summary>
        [XmlElement("taxType")]
        public int TaxType { get; set; }

        /// <summary>
        /// 显示名称
        /// </summary>
        [XmlElement("displayName")]
        public string DisplayName { get; set; }

        /// <summary>
        /// 纳税人识别号
        /// </summary>
        [XmlElement("taxpayerID")]
        public string TaxpayerID { get; set; }

        /// <summary>
        /// 长编号
        /// </summary>
        [XmlElement("longNumber")]
        public string LongNumber { get; set; }

        /// <summary>
        /// 银行账户
        /// </summary>
        [XmlElement("bankAccount")]
        public string BankAccount { get; set; }
    }
}

